package com.eclipsemail.core.authentication;

import java.util.Arrays;

import com.google.common.base.Preconditions;

public class Auth {

    private String login;
    private char[] pass;

    public Auth(String login, char[] pass) {
        this.login = Preconditions.checkNotNull(login);
        this.pass = Preconditions.checkNotNull(pass);
    }

    public String getLogin() {
        return login;
    }

    public char[] getPass() {
        return pass;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((login == null) ? 0 : login.hashCode());
        result = prime * result + Arrays.hashCode(pass);
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        Auth other = (Auth) obj;
        if (login == null) {
            if (other.login != null) {
                return false;
            }
        } else if (!login.equals(other.login)) {
            return false;
        }
        if (!Arrays.equals(pass, other.pass)) {
            return false;
        }
        return true;
    }

}
